FROM alpine:3.8

# 解决系统中文显示乱码问题
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

# 修改时区
RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories && \
    apk update && apk --no-cache add tzdata && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ 
    echo 'Asia/Shanghai' >/etc/timezone && \ 
    # 安装tengine依赖库文件
    apk del tzdata && apk --no-cache add build-base openssl-dev pcre-dev && \
    wget http://tengine.taobao.org/download/tengine-2.2.2.tar.gz -O /tmp/tengine-2.2.2.tar.gz && \
    cd /tmp && tar -zxvf tengine-2.2.2.tar.gz && cd /tmp/tengine-2.2.2 && ./configure && make && make install && \
    rm -rf /tmp/*

ENV PATH="/usr/local/nginx/sbin:$PATH"

RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log \
	&& ln -sf /dev/stderr /usr/local/nginx/logs/error.log

COPY nginx.conf /usr/local/nginx/conf/nginx.conf

EXPOSE 80

VOLUME /usr/local/nginx/html

STOPSIGNAL SIGTERM

CMD ["nginx", "-g", "daemon off;"]